<template>
	<scroll-view class="myScrollView" :scroll-y="y_on" :scroll-x="x_on" :style="[module_style]" @scrolltoupper="updateData" @scrolltolower="updateData">
		<slot></slot>
	</scroll-view>
</template>

<script>
import storeMixin from '@/store/storeMixin';
export default {
	mixins: [storeMixin],
	name: 'myScrollView',
	props: {
		x_on: {
			type: [Boolean],
			default: false,
		},
		y_on: {
			type: [Boolean],
			default: false,
		},
		width: {
			type: [Number, String],
			default: '0',
		},
		height: {
			type: [Number, String],
			default: '0',
		},
	},

	data() {
		return {};
	},
	created() {},
	mounted() {},
	computed: {
		module_style() {
			let style = {};
			if (this.width > 0) {
				style['width'] = `${this.width}rpx`;
			}
			if (this.height > 0) {
				style['height'] = `${this.height}rpx`;
			}
			return style;
		},
	},
	methods: {
		updateData() {
			this.$emit('updateData');
		},
	},
	watch: {},
};
</script>

<style lang="scss"></style>
